home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1994 / MacHack 1994.toast / MacHack™ 1987-1994 / MacHack™ '93 / Papers '93 / Macintosh as Internet Server ƒ / inetd / TCP.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-04-06  |  1.2 KB  |  77 lines  |  [TEXT/MPS ]

  1.  
  2. #ifndef __MYUTILS__
  3. #include <myUtils.h>
  4. #endif
  5. #ifndef __CLIST__
  6. #include <CList.h>
  7. #endif
  8. #ifndef __CQUEUE__
  9. #include <CQueue.h>
  10. #endif
  11.  
  12. #ifndef __MACTCPCOMMONTYPES__
  13. #include <MacTCPCommonTypes.h>
  14. #endif
  15. #ifndef __TCPPB__
  16. #include <TCPPB.h>
  17. #endif
  18.  
  19. class InetD;
  20. class TCPListener;
  21.  
  22. typedef struct MyTCPiopb {
  23.     TCPiopb            tcppb;
  24.     long            myA5;
  25.     TCPListener*    listener;
  26. } MyTCPiopb;
  27.  
  28. class NoteeItem : public CItem {
  29. public:
  30.     PSN            fPSN;
  31.     StreamPtr    fStream;
  32.     ProcPtr        fProc;
  33.     Ptr            fUsrPtr;
  34.     
  35.                 NoteeItem();
  36. };
  37.  
  38. class NoteeList : public CList {
  39. public:
  40.     NoteeItem*    GetItem(PSNPtr psn);
  41.     NoteeItem*    GetItem(StreamPtr stream);
  42. };
  43.  
  44. class TCPListener {
  45. public:
  46.     CQueue        fQueue;
  47.     NoteeList    fNoteeList;
  48.  
  49.     InetD*        fDaemon;
  50.     
  51.     int            fBufferSize;
  52.  
  53.                 TCPListener(InetD* daemon);
  54.                 ~TCPListener();
  55.     
  56.     Boolean        Initialize();
  57.     
  58.     void        DoNull();
  59.     
  60.     void        NotifyMe(PSNPtr psn, StreamPtr stream, ProcPtr proc, Ptr usr);
  61.     void        UnNotify(PSNPtr psn);
  62.  
  63.     void        Release();
  64.     void        CloseDown(MyTCPiopb* pb);
  65.     void        ListenOn(tcp_port port);
  66. };
  67.  
  68. extern "C" {
  69.     pascal void    TCPNotify(    StreamPtr stream,
  70.                             unsigned short eventCode,
  71.                             Ptr userDataPtr,
  72.                             unsigned short termReason,
  73.                             struct ICMPReport* icmp);
  74.                                         
  75.     void         TCPCompletion(TCPiopb* pb);
  76. };
  77.